package com.pureut.order.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pureut.order.domain.CustomerManagement;
import com.pureut.order.dto.CustomerManagementDto;
import com.pureut.order.export.CustomerManagementExport;
import com.pureut.order.vo.CustomerManagementVo;
import com.sale.common.mybatis.core.mapper.BaseMapperPlus;
import com.sale.order.api.dto.CustomerBalance;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 客户mapper
 */
@Mapper
public interface CustomerManagementMapper extends BaseMapperPlus<CustomerManagementMapper, CustomerManagement, CustomerManagement> {

    /**
     * 客户列表
     *
     * @param customerManagementVo
     * @return
     */
    Page<CustomerManagementDto> getCoustomerList(@Param("page") Page<CustomerManagementDto> page, @Param("customerManagementVo") CustomerManagementVo customerManagementVo);


    /**
     * 获取客户编号
     *
     * @return
     */
    List<CustomerManagementDto> getCustomerNumMax();

    /**
     * 客户信息导出
     */
    List<CustomerManagementExport> getExportList(@Param("customerManagementVo") CustomerManagementVo customerManagementVo);

    /**
     * 根据多个id获取数据
     */
    List<CustomerManagementExport> getDataByIdStr(@Param("idList") List<String> idList);

    /**
     * 根据客户名称获取数据
     * @param customerName
     * @return
     */
    CustomerManagement getCustomerId(String customerName);

    /**
     * 获取单个客户数据
     */
    CustomerManagementDto getCustomerManagementById(Long id);

    /**
     * 获取启用状态客户
     */
    List<CustomerManagementDto> selectOpenCustomerList();

    /**
     * 通过客户名称获取客户编码(财务模块使用)
     */
    String getCodeByCustomerName(String customerName);

    /**
     * 通过客户编码更新余额
     */
    boolean updateClientBalance(CustomerBalance customerBalance);
}
